home *** CD-ROM | disk | FTP | other *** search
/ Programming Windows 95 with MFC / Programming Windows 95 with MFC (Microsoft Programming Series)(097-0001465)(1996).iso / CODE / Chap01 / Hello.cpp next >
C/C++ Source or Header  |  1996-04-05  |  1KB  |  45 lines

  1. //***********************************************************************
  2. //
  3. //  Hello.cpp
  4. //
  5. //***********************************************************************
  6.  
  7. #include <afxwin.h>
  8. #include "Hello.h"
  9.  
  10. CMyApp myApp;
  11.  
  12. /////////////////////////////////////////////////////////////////////////
  13. // CMyApp member functions
  14.  
  15. BOOL CMyApp::InitInstance ()
  16. {
  17.     m_pMainWnd = new CMainWindow;
  18.     m_pMainWnd->ShowWindow (m_nCmdShow);
  19.     m_pMainWnd->UpdateWindow ();
  20.     return TRUE;
  21. }
  22.  
  23. /////////////////////////////////////////////////////////////////////////
  24. // CMainWindow message map and member functions
  25.  
  26. BEGIN_MESSAGE_MAP (CMainWindow, CFrameWnd)
  27.     ON_WM_PAINT ()
  28. END_MESSAGE_MAP ()
  29.  
  30. CMainWindow::CMainWindow ()
  31. {
  32.     Create (NULL, "The Hello Application");
  33. }
  34.  
  35. void CMainWindow::OnPaint ()
  36. {
  37.     CPaintDC dc (this);
  38.     
  39.     CRect rect;
  40.     GetClientRect (&rect);
  41.  
  42.     dc.DrawText ("Hello, MFC", -1, &rect,
  43.         DT_SINGLELINE | DT_CENTER | DT_VCENTER);
  44. }
  45.